﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ZFBActivation.Core
{
    public class TBServer
    {
        private static readonly object objLock = new object();
        private static TBServer  tBServer;

        public static TBServer Instance {
            get {
                if (tBServer == null)
                    lock (objLock) {
                        if (tBServer == null) tBServer = new TBServer();
                    }

                return tBServer;
            }
        }
        private int m_max = 0;
        private int m_now = 0;
        public void Init(int max) {
            m_max = max;
        }

        public void SetState() {
            m_now++;
        }

        public void ReMax() {
            m_now = 0;
        }

        public bool IsOK() {
            return m_now == m_max;
        }

        private int m_nowendState = 0;
        public void EndState() {
            m_nowendState++;
        }

        public bool EndStateIsOK() {
            return m_nowendState == m_max;
        }

    }
}
